package cn.fansunion.concurrent.threadabc;

//有3个线程ABC。按照ABC来运行（A线程输出A，B线程输出B，C线程输出C，以此类推，循环输出）。
public class ThreadABCTest2 {
	
	public static void main(String[] args) {
		ThreadTask aThread = new ThreadTask("A");
		ThreadTask bThread = new ThreadTask("B");
		ThreadTask cThread = new ThreadTask("C");
		
		for(int index=0;index<10;index++){
			aThread.start();
			try {
				aThread.join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			bThread.start();
			try {
				bThread.join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			cThread.start();
			try {
				cThread.join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}

	}
	
	

}
